package kr.hkit.androidcomplete02.ch17;

import kr.hkit.androidcomplete02.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class ApplicationTest extends Activity {
	static final String TAG = "APPLICATION";
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch17_application);
		updateNowMode();
	}
	
	public void mOnClick(View v){
		ApplicationEx app = (ApplicationEx)getApplication();
		switch(v.getId()){
		case R.id.ch17_beginner:
			app.setmMode(ApplicationEx.BEGINNER);
		
		case R.id.ch17_professional:
			app.setmMode(ApplicationEx.PREFESSIONAL);
		}
		updateNowMode();
	}
	
	private void updateNowMode(){
		TextView tv = (TextView)findViewById(R.id.ch17_mode);
		ApplicationEx app = (ApplicationEx)getApplication();
		
		if(app.getmMode() == ApplicationEx.BEGINNER){
			tv.setText("현재 모드  : 초보자 모드");
		} else{
			tv.setText("현재 모드  : 숙련자 모드");
		}
			
	}
	
}	
